t = input()
flag = True
s = []
for char in t:
    if char in '([{<':
        s.append(char)
    elif char in ')]}>':
        if not s:
            flag = False
            break
        elif ord(char) - ord(s[-1]) in (1, 2):
            s.pop()
        else:
            flag = False
            break

if flag and not s:
    print("Yes")
else:
    print("No")
